<%@ page language="java" pageEncoding="UTF-8"
	contentType="text/html; charset=utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sx" uri="/struts-dojo-tags"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<head>
	<sx:head />
	<link href="style/style1.css" rel="stylesheet" type="text/css">
	<script language="JavaScript" src="javascript/blogValidator.js"></script>
	<script type="text/javascript" src="javascript/table.js"></script>
	<%
		//全局变量设置，显示的文章日记字数
	%>
	<s:set name="begin" value="0"></s:set>
	<s:set name="end" value="20"></s:set>
</head>
<div id="home">
	<table width="100%">
		<tr>
			<td width="330px">
				<div id="homeLeft">
					<div class=" homeTitle ">
						个人信息
					</div>
					<table width="340px" height="170px"
						style="border-bottom: 1px #ffffff dashed">
						<tr>
							<td colspan="2">
								<div align="center">
									<img src="UploadImages/${user.headImage}" height="170px"
										width="200px">
									&nbsp;
								</div>
								<div align="center">
									<s:if test="#session.user.account!=#session.blogUser.account">
									加为博友</s:if>
								</div>
							</td>
						</tr>
						<tr>
							<td width="40">
								&nbsp;
							</td>
							<td width="100">
								博客等级 &nbsp; ${user.blogGrade}
							</td>
						</tr>
						<tr>
							<td>

							</td>
							<td>
								总访问量 &nbsp; ${user.visitNumber}
							</td>


						</tr>
					</table>
					<div class="homeTitle">
						好友
					</div>
					<table width="330" height="180"
						style="border-bottom: 1px #ffffff dashed">
						<c:if test="${empty friends }">
							<div>
								还没有添加好友哦~
							</div>
						</c:if>
						<tr>

							<s:iterator value="friends" id="friend" status="status">


								<td>
									<div class="friendImg">

										<a href="browseUser.action?account=${friend.account} "><img
												src="UploadImages/${friend.headImage}" height="50px"
												width="60px" onmouseout='this.className="friendPic1"'
												onmouseover='this.className="friendPic2"' /> </a>

										<br>

										<a href="browseUser.action?account=${friend.account} ">${friend.account}
										</a>
									</div>

								</td>
								<s:if test="#status.index%3==2">
						</tr>
						<tr>
							</s:if>

							</s:iterator>
						</tr>
					</table>
					<div class="homeTitle">
						留言
					</div>

					<table height="180" width="340">
						<c:if test="${empty leaveMessageList }">
							<div>
								还没有留言哦~
							</div>
						</c:if>

						<s:iterator value="leaveMessageList" id="message" status="st">

							<tr
								<s:if test="#st.odd==false">style="background-color: #fff"</s:if>
								onmouseover="onDivOver(this)" onmouseout="onDivOut(this)">
								<td colspan="3" style="border-bottom: 1px #ffffff dashed">
									<span  class="titleFont"><a href="browseUser.action?account=${author} ">
											${author}</a> </span>

									<SPAN class="spanFont"> ${leaveDate}</SPAN>

									<div>
										<c:if test="${fn:length(message.leaveMsg)<20}">
								${message.leaveMsg}
								
								
								</c:if>
										<c:if test="${fn:length(message.leaveMsg)>=20}">
								${fn:substring(message.leaveMsg, begin, end)}......	
								</c:if>
									</div>
								</td>
							</tr>
						</s:iterator>

						<tr>
							<td width="200">
								&nbsp;
							</td>
							<td colspan="2">
								<div align="right">
									<sx:a id="leaveMsg"
										href="browseLeaveMsg.action?account=%{account}"
										targets="msgList">查看所有留言</sx:a>
								</div>
							</td>
						</tr>
					</table>

				</div>
				&nbsp;
			</td>

			<td valign="top">
				<div id="homeRight">
					<div id="homeRight1">
						<div class=homeTitleMiddle>
							<a href="/blog/listBlog.action?account=${user.account}"
								target="_blank">近期日志</a>
						</div>
						<table width="670" height="100">
							<c:if test="${empty blogList.pageList }">
								<div>
									近期还没有写日志哦~
								</div>
							</c:if>

							<s:iterator value="blogList.pageList" id="blog" status="st">

								<tr
									<s:if test="#st.odd==false">style="background-color: #fff"</s:if>
									onmouseover="onDivOver(this)" onmouseout="onDivOut(this)">
									<td style="border-bottom: 1px #ffffff dashed">
										<div>
											<SPAN class="titleFont"><a
													href="/blog/browseBlog.action?articleId=${blog.articleId}"
													target="_blank"><s:property value="#blog.articleTitle" />
												</a>
										 </SPAN>
											<SPAN class="spanFont"><s:date
													name="#blog.articlePublishDate" format="yyyy-MM-dd HH:mm" />
											</SPAN>
										</div>
										<br>
										<div class="smallfont">

											类别：
											<s:if test="#blog.voice!=null&&#blog.voice!=''">  
								  语音日志
					            </s:if>
											<s:else>
					             普通日志
		                       </s:else>
											<span class="span1"><a
												href="/blog/browseBlog.action?articleId=${blog.articleId}"
												target="_blank">阅读（${blog.visitNumber}）</a> </span>
											<span class="span1"><a
												href="/blog/browseBlog.action?articleId=${blog.articleId}"
												target="_blank">评论(${fn:length(blog.comments)})</a> </span>
											<span class="span1"><a
												href="/blog/browseBlog.action?articleId=${blog.articleId}"
												target="_blank">阅读全文</a> </span>
										</div>
									</td>
								</tr>


							</s:iterator>
							<c:if test="${! empty blogList.pageList }">
								<tr>

									<td class="page">
										<div>
											<span class="pagerFont"> <s:if
													test="!blogList.isFirstPage()">
													<sx:a id="link1"
														href="pageList.action?page=first&account=%{user.account }"
														targets="homeRight1">首页 </sx:a>

													<sx:a id="link3"
														href="pageList.action?page=previous&account=%{user.account }"
														targets="homeRight1">上一页 </sx:a>
												</s:if> 共 <s:property value="blogList.getPageCount()" /> 页
												&nbsp;&nbsp; 当前第 <s:property value="blogList.getPage()+1" />
												<s:if test="!blogList.isLastPage()">
													<sx:a id="link4"
														href="pageList.action?page=next&account=%{user.account }"
														targets="homeRight1">下一页 </sx:a>
													<sx:a id="link2"
														href="pageList.action?page=last&account=%{user.account }"
														targets="homeRight1">末页 </sx:a>
												</s:if> </span>
										</div>

									</td>
								</tr>
							</c:if>
						</table>
					</div>
					<div class="homeRight2">
						<div class=homeTitleMiddle>
							<a href="/blog/listAlbums.action?account=${user.account}"
								target="_blank" class="titleFont">近期相册</a>
						</div>
						<table class="tableAblum"
							style="border-bottom: 1px #ffffff dashed margin-top :                                                                                                                                             0px;"
							width="80%" height="315">
							<c:if test="${empty ablumList}">
                                     近期还没添加相册哦~
                            </c:if>
							<tr>
								<s:iterator value="ablumList" status="status">

									<td align="center">
										<div class="alblum" align="center">
											<div align="center" class="picAblum">
												<a
													href="showPicture.action?albumId=<s:property value='albumId'/>"
													onmouseover='this.className="alblum2"'
													onmouseout='this.className="alblum2"'> <img
														src="images/top5.jpg" class="alblum1"
														alt="<s:property value="albumDescription" />"
														onmousemove='' onmouseout='this.className="alblum1"'
														onmouseover='this.className="alblum2"'> </a>
											</div>
											<div align="center" class="Ablumfont">
												<s:property value="albumName" />
											</div>
										</div>

									</td>
									<s:if test="#status.index%3==2">
							</tr>
							<tr>
								</s:if>
								</s:iterator>
							</tr>
						</table>
					</div>
				</div>
	</table>
</div>
<div id="homeLeaveMessage">

	<div id="leavemsg" align="center">
		<s:form name="leavemsg" action="leavemsg.action"
			onsubmit="return leaveMessageValidate()">
			<table width="60%">
				<tr>
					<td>
						留言:
					</td>
					<td>
						<textarea name="message.leaveMsg" id="message" cols="60" rows="5"></textarea>
					</td>
				</tr>
				<tr>
					<td align="center" colspan="2">
						<input class="button"
							onmouseover="this.className='buttonMouseOver'"
							onmouseout="this.className='button'" type="submit" value="提交" />
						<sx:submit targets="parentDiv" showLoadingText="false"
							indicator="loadingImage" />

					</td>
				</tr>
			</table>
			<s:hidden name="account" value="%{user.account}"></s:hidden>

		</s:form>
	</div>
	<div id="msgList"></div>
</div>

